# -*- coding: utf-8 -*-

from flask import Blueprint

user_blueprint = Blueprint('user', __name__)


def register(app, url_prefix, options, prototype=False):
    """ """
    if prototype:
        from . import prototype_views as views  
    else:
        from . import views
        from .backends.working import models
        models.USER_NAME_VALIDATOR = options['user_name_validator']   
    
        
    user_blueprint.add_url_rule('/<username>',
        'view_user_data',
        views.view_user_data,
        methods=['GET']
    )
    
    user_blueprint.add_url_rule('/json/<username>',
        'view_user_data_json',
        views.view_user_data_json,
        methods=['GET']
    )
    
    app.register_blueprint(user_blueprint, url_prefix=url_prefix)
